package org.ddd.specification.catalog.collection;

import java.util.Map;

import org.ddd.specification.Specification;
import org.ddd.specification.catalog.AbstractSpecification;

/**
 * Specification which checks an entry value.
 * 
 * @author Jeroen van Schagen
 * @since 24-02-2011
 *
 * @param <T> type of value being checked
 */
public class MapEntryValueSpecification<T> extends AbstractSpecification<Map.Entry<?, T>> {
    private final Specification<T> delegate;

    public MapEntryValueSpecification(Specification<T> delegate) {
        this.delegate = delegate;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isSatisfiedBy(Map.Entry<?, T> candidate) {
        return delegate.isSatisfiedBy(candidate.getValue());
    }

}
